package cn.ruituo.adv7.bank;

//银行账户
public class Account {
    private String acno;
    private int money;//余额

    public Account(String acno, int money) {
        this.acno = acno;
        this.money = money;
    }

    //取钱
    public boolean takeAway(int m) {
        if (m > money)
            return false;

        try {
            Thread.sleep(50);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        money -= m;
        return true;
    }
    //存钱
    public void deposit(int m){
        this.money+=m;
    }

    public String getAcno() {
        return acno;
    }

    public int getMoney() {
        return money;
    }
}
